home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-06
/
an102x.zip
/
ADDRESS.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-04-09
|
2KB
|
92 lines
/*****************************************************************************
* ADDRESS.C
*
* 90-12-27 Matt Hagen, Novell, Inc.
*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#define BYTE unsigned char
#define WORD unsigned short
#define LONG unsigned long
typedef struct
{
BYTE inUse;
BYTE order;
BYTE net[4];
BYTE node[6];
BYTE socket[2];
BYTE timeout[2];
BYTE immedAddr[6];
BYTE sequence;
BYTE connectionNum;
BYTE connectionStatus;
BYTE maxTimeout[2];
BYTE reserved[5];
}ConnIDTable;
extern int GetConnectionIDTableEntry(
WORD connID,
ConnIDTable *entry);
int GetServerAddress(
WORD connID,
BYTE *net,
BYTE *node,
BYTE *immediate);
/*****************************************************************************
* main
*****************************************************************************/
main()
{
WORD c;
BYTE net[4];
BYTE node[6];
BYTE immediate[6];
for(c=1;c<9;c++)
{
GetServerAddress(c,net,node,immediate);
printf("Slot %d %.2X%.2X%.2X%.2X ",c,net[0],net[1],net[2],net[3]);
printf("%.2X%.2X%.2X%.2X%.2X%.2X ",node[0],node[1],node[2],node[3],node[4],node[5]);
printf("%.2X%.2X%.2X%.2X%.2X%.2X\n",immediate[0],immediate[1],immediate[2],immediate[3],immediate[4],immediate[5]);
}
return(0);
}
/*****************************************************************************
* GetServerAddress
*
* connID is an index (1..8) into the table. net points to a four-byte buffer
* for the server's network address. node points to a 6-byte buffer for the
* server's node address. immediate points to a 6-byte buffer for the node
* address of the router that routes packets from the client to the server.
* This routine returns 0 for successful and -1 if connID is an invalid number.
*****************************************************************************/
int GetServerAddress(
WORD connID,
BYTE *net,
BYTE *node,
BYTE *immediate)
{
ConnIDTable e;
if(GetConnectionIDTableEntry(connID,&e)!=0)
return(-1);
memmove(net,&e.net,4);
memmove(node,&e.node,6);
memmove(immediate,&e.immedAddr,6);
return(0);
}
/****************************************************************************/
/****************************************************************************/